
	** Tanzania
	** Clean Wave 1
	
		** Urban status
		
			use "$dir/rawdata/LSMS Tanzania/2008/SEC_A_T.dta", clear
			gen w1_urban=rural=="Urban" if !missing(rural)
			keep hhid w1_urban
			tempfile urban
			save `urban', replace
			
		** Roster
		
			use "$dir/rawdata/LSMS Tanzania/2008/SEC_B_C_D_E1_F_G1_U.dta", clear
			
			gen w1_inhh=1

			bys hhid: egen w1_hh_size=total(w1_inhh)
		
			** Age
			gen w1_age=sbq4
			
			** Female
			gen w1_female=sbq2==2 if !missing(sbq2)
			
			** Marital status
			gen w1_married=(sbq18==1 | sbq18==2) if !missing(sbq18)
		
			** Working for a wage outside the household
			gen w1_work_outsideHH=seq9==1 if !missing(seq9)
			replace w1_work_outsideHH=0 if seq3==2 // Imperfect, but otherwise think this was artificially high
			gen w1_work_outsideHH_hrs=seq19
				
			** Working in agriculture for a HH member
			gen w1_work_agHH_hrs=seq46_hr if seq46_hr!=999
			gen w1_work_agHH=w1_work_agHH_hrs>0 if !missing(w1_work_agHH_hrs)
			replace w1_work_agHH=0 if seq3==2 // Imperfect, but otherwise think this was artificially high
				
			** Working in HH business
			gen w1_work_bizHH_hrs=seq45
			gen w1_work_bizHH=w1_work_bizHH_hrs>0 if !missing(w1_work_bizHH_hrs)
			replace w1_work_bizHH=0 if seq3==2 // Imperfect, but otherwise think this was artificially highåå
				
			** Any work in last 7 days (agriculture, for non-HH member, own account/business)
			egen w1_worked_last7days=rowmax(w1_work_outsideHH w1_work_agHH w1_work_bizHH)
			
			** Hours worked in last 7 days
			egen w1_work_hrs=rowtotal(w1_work_outsideHH_hrs w1_work_agHH_hrs w1_work_bizHH_hrs)
			replace w1_work_hrs=. if missing(w1_work_outsideHH_hrs) & missing(w1_work_agHH_hrs) & missing(w1_work_bizHH_hrs)

		** Disabilities
			** Difficulty seeing
			*n/a
			
			** Difficulty hearing
			*n/a

			** Difficulty walking or climbing stairs	
			tab1 sdq16_2 sdq16_3 sdq16_4 sdq16_5
			gen diff_walk_up=(sdq16_2==2) if !missing(sdq16_2)
			gen diff_bend_over=(sdq16_3==2) if !missing(sdq16_3)
			gen diff_walk_more_km=(sdq16_4==2) if !missing(sdq16_4)
			gen diff_walk_more_me=(sdq16_5==2) if !missing(sdq16_5)
			gen w1_diff_walk_clim=(																	 ///
				diff_walk_up==1 | diff_bend_over==1 | diff_walk_more_km==1 | diff_walk_more_me==1	 ///
				)
			replace w1_diff_walk_clim=. if (														 ///
				missing(diff_walk_up) &																 ///
				missing(diff_bend_over) & 														     ///
				missing(diff_walk_more_km) & 														 ///
				missing(diff_walk_more_me)															 ///
				)
																									
			tab1 w1_diff_walk_clim

			** Difficulty remembering
			*n/a

			** Difficulty with self-care
			gen w1_diff_self_care=(sdq16_6==2) if !missing(sdq16_6)
			tab1 w1_diff_self_care

			** Difficulty communicating
			*n/a

			keep hhid sbmemno w1_*
			ren sbmemno rosterid
			
			tempfile roster
			save `roster', replace
			
		** Illness and injury
			
			* n/a
				
		** Merge and save
			
			use `roster', clear
			merge m:1 hhid using `urban', gen(merge_urban) keep(master matched)
			
			ren hhid hhid_w1
			ren rosterid indiv
			
			save "$dir/data/tza_w1_individual.dta", replace
			
		